package com.example.xxcjgl.navigation

import androidx.compose.runtime.Composable
import androidx.navigation.compose.rememberNavController
import com.example.xxcjgl.ui.screens.AddScoreScreen
import com.example.xxcjgl.ui.screens.AddStudentScreen
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import com.example.xxcjgl.ui.screens.LoginScreen
import com.example.xxcjgl.ui.screens.MainScreen

// Navigation.kt
@Composable
fun AppNavigation() {
    val navController = rememberNavController()

    NavHost(navController = navController, startDestination = "login") {
        composable("login") {
            LoginScreen(
                onLoginSuccess = { navController.navigate("main") }
            )
        }
        composable("main") {
            MainScreen(
                onAddStudent = { navController.navigate("addStudent") },
                onAddScore = { navController.navigate("addScore") }
            )
        }
        composable("addStudent") {
            AddStudentScreen(
                onBack = { navController.popBackStack() }
            )
        }
        composable("addScore") {
            AddScoreScreen(
                onBack = { navController.popBackStack() }
            )
        }
    }
}